Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

488 include deviceregistration in devicedeploymentstatus #489

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

yuanchen233
Copy link
Collaborator

DeviceRegistration is added to DeviceDeploymentStatus, which is part of StudyDeploymentStatus. A new interface HasDeviceRegistration is introduced to keep this field since Unregistered would not need this field.

A regression test case was added in a separate commit as I'm not sure if it is desired. The test case amis to test GetStudyDeploymentStatusList endpoint with registered devices in one of the deployments. This is not covered since DeploymentServiceTest tests minimum usage for GetStudyDeploymentStatusList, as it is just a list representation of GetDeploymentStatus. I added it since json migration for this endpoint works differently.

@yuanchen233 yuanchen233 linked an issue Oct 24, 2024 that may be closed by this pull request
@yuanchen233 yuanchen233 marked this pull request as ready for review October 24, 2024 13:05
Copy link
Member

@Whathecode Whathecode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smaller comments I fixed in a fixup commit.

Some bigger observations:

  • I would have expected a migration to be set up for RecruitmentService in the studies subsystem as well, which returns ParticipantGroupStatus, which contains StudyDeploymentStatus once "invited". It's odd there are no failing tests on this. 🤔
  • Extra test cases seem relevant (also see my comment on a bug which wasn't caught due to lacking coverage of DeploymentService). But, if you add them for past versions (p.s. you added it to 1.0 and not 1.1, was that intentional?), make sure they were generated with code for that version. You may have to branch out from an old release, write the test there, and then possibly do a cherry-pick on this branch.

"dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.CreateStudyDeployment",
"dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.GetStudyDeploymentStatus",
"dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.UnregisterDevice",
"dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.DeployDevice",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be DeviceDeployed. 🤔 Why does it work? I'm not a big TDD fan, but there is something to seeing a test fail before making it pass.

Seems like luck would have it that's exactly where coverage is missing. 😅 Could you add a preceding commit which provides coverage for DeploymentService.deviceDeployed()? And, while at it, verify that all the other endpoints of this service are actually called in the current regression tests.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only have coverage for CreateStudyDeployment, if I remember correctly that was the only failing test, as Actual testing of the status responses should already be covered adequately in StudyDeployment tests., but the regression test case are generated from DeploymentServiceTest.

Extra test cases seem relevant

Do we only want the generated json request files, or we also want those tests in DeploymentServiceTest? I think I'll include them first anyways to agree on the test cases, and they can be removed later if not desired.

I added it to 1.0 because I felt the test case was needed from the start of this major version, not due to some changes introduced in 1.1. Then simlly forget to add them 1.1 😛. As I generated those json files in ver. 1.0 and see a list of diff with origional ones, wandering what I breaked and realized those are the generated UUIDs difference...

Copy link
Member

@Whathecode Whathecode Oct 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we only want the generated json request files, or we also want those tests in DeploymentServiceTest?

I'd always keep them in sync, so that it's just a matter of copying the output of all of them over.

But, obviously the comment I left in code there didn't consider the implications on reduced regression testing of the infrastructure layer (JSON) by not covering all potential input/output. 😅 So albeit valid—there is plenty of functional coverage in StudDeploymentTest—, that doesn't cover serialization and JSON schema definitions.

I think it would make sense to write test cases that try to cover as much as possible, rather than writing them as unit tests. These are more or less integration tests after all. So, I'd focus on longer scenarios with multiple calls reflecting fuller study lifetime to get more coverage for the infrastructure layer.

As I generated those json files in ver. 1.0 and see a list of diff with origional ones, wandering what I breaked and realized those are the generated UUIDs difference...

I actually spotted that. 🤔. I thought I injected some more deterministic GUID and timestamp generator for the creation of these tests. I saw it in some test resources, but not others. I don't remember whether that's expected/normal, or oversight.

rpc/schemas/deployments/DeviceDeploymentStatus.json Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Include DeviceRegistration in DeviceDeploymentStatus
2 participants